package com.wgh.common.constant;

/**
 * 系统常量类
 * 
 * @author AI Shop
 */
public class Constants {
    // 公共常量
    public static final String SUCCESS = "0";
    public static final String FAIL = "1";
    public static final String YES = "Y";
    public static final String NO = "N";
    
    // 分页常量
    public static final Integer DEFAULT_PAGE_NUM = 1;
    public static final Integer DEFAULT_PAGE_SIZE = 10;
    public static final Integer MAX_PAGE_SIZE = 100;
    
    // Redis Key前缀
    public static final String REDIS_KEY_PREFIX = "ai_shop:";
    
    // 商品相关常量
    public class Product {
        // 商品状态
        public static final Integer PRODUCT_STATUS_OFF_SHELF = 0; // 下架
        public static final Integer PRODUCT_STATUS_ON_SHELF = 1;  // 上架
        
        // 商品类型
        public static final Integer PRODUCT_TYPE_PHYSICAL = 0; // 实物商品
        public static final Integer PRODUCT_TYPE_VIRTUAL = 1;  // 虚拟商品
        
        // 审核状态
        public static final Integer AUDIT_STATUS_PENDING = 0;  // 待审核
        public static final Integer AUDIT_STATUS_APPROVED = 1; // 审核通过
        public static final Integer AUDIT_STATUS_REJECTED = 2; // 审核拒绝
        
        // 是否组合商品
        public static final Integer IS_COMBINATION_NO = 0; // 否
        public static final Integer IS_COMBINATION_YES = 1;  // 是
        
        // 排序字段
        public static final String SORT_FIELD_CREATE_TIME = "create_time";
        public static final String SORT_FIELD_SALE_COUNT = "sale_count";
        public static final String SORT_FIELD_PRICE = "sale_price";
        public static final String SORT_FIELD_VIEW_COUNT = "view_count";
    }
    
    // SKU相关常量
    public class Sku {
        // SKU状态
        public static final Integer SKU_STATUS_DISABLED = 0; // 禁用
        public static final Integer SKU_STATUS_ENABLED = 1;  // 启用
    }
    
    // 分类相关常量
    public class Category {
        // 分类状态
        public static final Integer CATEGORY_STATUS_DISABLED = 0; // 禁用
        public static final Integer CATEGORY_STATUS_ENABLED = 1;  // 启用
        
        // 分类层级
        public static final Integer CATEGORY_LEVEL_1 = 1; // 一级分类
        public static final Integer CATEGORY_LEVEL_2 = 2; // 二级分类
        public static final Integer CATEGORY_LEVEL_3 = 3; // 三级分类
    }
    
    // 品牌相关常量
    public class Brand {
        // 品牌状态
        public static final Integer BRAND_STATUS_DISABLED = 0; // 禁用
        public static final Integer BRAND_STATUS_ENABLED = 1;  // 启用
    }
    
    // 库存相关常量
    public class Inventory {
        // 变动类型
        public static final Integer CHANGE_TYPE_IN = 1;    // 入库
        public static final Integer CHANGE_TYPE_OUT = 2;   // 出库
        public static final Integer CHANGE_TYPE_CHECK = 3; // 盘点
        public static final Integer CHANGE_TYPE_ADJUST = 4; // 调整
    }
    
    // 商品评价相关常量
    public class Review {
        // 评价状态
        public static final Integer REVIEW_STATUS_PENDING = 0;  // 待审核
        public static final Integer REVIEW_STATUS_PUBLISHED = 1; // 已发布
        public static final Integer REVIEW_STATUS_SHIELDED = 2; // 已屏蔽
        
        // 是否有图/视频
        public static final Integer HAS_IMAGE_NO = 0; // 否
        public static final Integer HAS_IMAGE_YES = 1;  // 是
        public static final Integer HAS_VIDEO_NO = 0; // 否
        public static final Integer HAS_VIDEO_YES = 1;  // 是
        
        // 是否匿名
        public static final Integer IS_ANONYMOUS_NO = 0; // 否
        public static final Integer IS_ANONYMOUS_YES = 1;  // 是
    }
    
    // 商品关联相关常量
    public class Relation {
        // 关联类型
        public static final Integer RELATION_TYPE_MATCH = 0;    // 搭配推荐
        public static final Integer RELATION_TYPE_RELATED = 1;  // 相关商品
        public static final Integer RELATION_TYPE_COMBINATION = 2; // 组合商品
    }
    
    // 商品属性相关常量
    public class Attribute {
        // 属性类型
        public static final Integer ATTRIBUTE_TYPE_SPEC = 0;  // 规格属性
        public static final Integer ATTRIBUTE_TYPE_COMMON = 1; // 普通属性
    }
    
    // Kafka主题
    public class KafkaTopic {
        public static final String PRODUCT_CREATE = "product-create-topic";
        public static final String PRODUCT_UPDATE = "product-update-topic";
        public static final String PRODUCT_DELETE = "product-delete-topic";
        public static final String PRODUCT_SHELF_STATUS_CHANGE = "product-shelf-status-change-topic";
        public static final String INVENTORY_CHANGE = "inventory-change-topic";
        public static final String ORDER_CREATE = "order-create-topic";
    }
    
    // Redis缓存键
    public class RedisKey {
        public static final String PRODUCT_DETAIL = REDIS_KEY_PREFIX + "product:detail:%s";
        public static final String PRODUCT_LIST = REDIS_KEY_PREFIX + "product:list";
        public static final String CATEGORY_TREE = REDIS_KEY_PREFIX + "category:tree";
        public static final String BRAND_LIST = REDIS_KEY_PREFIX + "brand:list";
        public static final String INVENTORY_SKU = REDIS_KEY_PREFIX + "inventory:sku:%s";
        public static final String PRODUCT_REVIEW = REDIS_KEY_PREFIX + "product:review:%s";
        public static final String PRODUCT_VIEW_COUNT = REDIS_KEY_PREFIX + "product:view_count:%s";
    }
    
    // 限流常量
    public class RateLimit {
        public static final String REQUEST_LIMIT = "request_limit";
        public static final Integer DEFAULT_LIMIT = 100; // 默认限流100次/分钟
    }
    
    // 文件上传常量
    public class FileUpload {
        public static final String IMAGE_DIR = "/images/";
        public static final String VIDEO_DIR = "/videos/";
        public static final String ALLOWED_IMAGE_EXTENSIONS = ".jpg,.jpeg,.png,.gif,.bmp";
        public static final String ALLOWED_VIDEO_EXTENSIONS = ".mp4,.avi,.mov,.wmv";
        public static final long MAX_FILE_SIZE = 10485760L; // 10MB
    }
}